package com.xiaor.rssmodel.model.common;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * 公共字段
 */
@Entity
@Data
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@EntityListeners(AuditingEntityListener.class)  //自动更新时间字段
public class Common {
    @Id
    private Long id;
    @CreatedDate
    @Column(columnDefinition = "datetime comment '创建时间'")
    @JsonFormat(
            pattern = "yyyy年MM月dd日",
            timezone = "GMT+8"
    )
    private Date create_time;
    @CreatedDate
    @Column(columnDefinition = "datetime comment '更新时间'")
    @JsonFormat(
            pattern = "yyyy年MM月dd日",
            timezone = "GMT+8"
    )
    private Date update_time;
    @Column(columnDefinition = "tinyint(1) default 0 comment '逻辑删除'")
    private Boolean is_delete;
}